<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>
    /*.layui-table[lay-skin=line] td, .layui-table[lay-skin=line] th{*/
    /*max-width: 250px;*/
    /*}*/
</style>
<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="/admin/Tripcdk/index.shtml" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="tripname" value="{if isset($wherelist['tripname'])}{$wherelist['tripname']}{/if}" lay-verify="title" autocomplete="off" placeholder="请输入行程名称" class="layui-input layui-btn-sm">
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <a href="{:url('admin/Tripcdk/addcdk')}" class="layui-btn layui-btn-sm a_menu">
                        新建行程cdk
                    </a>
                    <!--<a href="{:url('admin/trip/combination')}" class="layui-btn layui-btn-sm a_menu">-->
                    <!--组合行程-->
                    <!--</a>-->
                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <col width="10%">
            <col width="15%">
            <col width="15%">
            <col width="15%">
            <col width="10%">
            <col width="15%">
            <col width="10%">
            <col width="10%">
        </colgroup>
        <thead>

        <tr>
            <th>ID</th>
            <th >行程名称</th>
            <th>创建日期</th>
            <th>到期时间</th>
            <th>关联的用户</th>
            <th>CDK</th>
            <th>定制师</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="dat" id="vo"}
        <tr>
            <td>{$vo.tripcdk_id}</td>
            <td style=" overflow: hidden;text-overflow:ellipsis; white-space: nowrap; vertical-align: middle;">{$vo.trip.name}</td>
            <td>{$vo.uptime|date='Y-m-d H:i:s',###}</td>
            <td>{$vo.endtime|date='Y-m-d H:i:s',###}</td>
            <td>
                {notempty name="$vo.member_id"}{$vo.member.member_nickname}{/notempty}
            </td>
            <td>{$vo.CDK}</td>
            <td>{$vo.admin.nickname}</td>
            <td class="operation-menu">
                <a class="layui-btn layui-btn-xs layui-btn-danger delete"  codeid="{$vo.tripcdk_id}" style="margin-right: 0;font-size:12px;">删除</a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$dat->render()}</div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>


    <script type="text/javascript">

        $('.delete').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定要删除?', function(index) {
                $.ajax({
                    url:"{:url('admin/Tripcdk/dcl')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })

        $('.copy').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定复制吗?', function(index) {
                $.ajax({
                    url:"{:url('admin/trip/copytrip')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })

    </script>
    <script type="text/javascript">
        layui.use('layer', function(){
            var layer = layui.layer;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['700px', '680px'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })

            $('.preview').click(function(){
                var url = $(this).attr('href');
                layer.open({
                    type:2,
                    content:url,
                    area: ['550px', '400px']
                });
                return false;
            })
        });
    </script>

</body>
</html>
